package com.happyclub.lbjcontroller;

import com.happyclub.lbj.service.IOrderProduct;
import com.happyclub.pojo.TbOrder;
import com.happyclub.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 高欢
 * @description TODO
 * @date 2019/4/12
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    IOrderProduct iOrderProduct;

    @RequestMapping(value = "/saveOrderPro/{shopCarId}",method = RequestMethod.POST)
    public JsonResult saveOrderPro(@PathVariable String shopCarId){
        return iOrderProduct.saveOrderPro(shopCarId);
    }

    @RequestMapping(value = "/saveOrder",method = RequestMethod.POST)
    public JsonResult saveOrder(@RequestBody TbOrder tbOrder){
        return iOrderProduct.saveOrder(tbOrder);
    }

    @RequestMapping(value = "/statisticsProSalesVolume/{orderId}",method = RequestMethod.PUT)
    public JsonResult statisticsProSalesVolume(@PathVariable String orderId){
        return iOrderProduct.statisticsProSalesVolume(orderId);
    }
    @RequestMapping(value = "/delAllByOrderId/{orderId}",method = RequestMethod.DELETE)
    public JsonResult delAllByOrderId(@PathVariable String orderId){
        return iOrderProduct.delAllByOrderId(orderId);
    }

    @RequestMapping(value = "/findOrderProByUserId/{userId}",method = RequestMethod.GET)
    public JsonResult findOrderProByUserId(@PathVariable String userId){
        return iOrderProduct.findOrderProByUserId(userId);
    }

    @RequestMapping(value = "/findOrderProDetailByOrderId/{orderId}",method = RequestMethod.GET)
    public JsonResult findOrderProDetailByOrderId(@PathVariable String orderId){
        return iOrderProduct.findOrderProDetailByOrderId(orderId);
    }


}
